package com.julian.adapterPattern;

import java.util.Enumeration;
import java.util.Iterator;

/**
 * 迭代器的枚举适配器
 */
public class IteratorEnumration implements Enumeration {
    Iterator iterator;

    public IteratorEnumration(Iterator iterator) {
        this.iterator = iterator;
    }

    @Override
    public boolean hasMoreElements() {
        return iterator.hasNext();
    }

    @Override
    public Object nextElement() {
        return iterator.next();
    }
}
